package cn.template.serve_project.service.impl;

import cn.template.serve_project.entity.Menu;
import cn.template.serve_project.mapper.MenuMapper;
import cn.template.serve_project.service.MenuService;
import cn.template.serve_project.vo.menu.MenuVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 菜单(Menu)表服务实现类
 *
 */
@Service("menusService")
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    private final MenuMapper menuMapper;

    MenuServiceImpl(  MenuMapper menuMapper){
        this.menuMapper = menuMapper;
    }

    /**
     * 根据角色查询所有菜单
     *
     * @param roleId 角色id
     * @return 菜单列表
     */
    @Override
    public List<MenuVO> selectAllByRole(Integer roleId) {
        return  menuMapper.selectByRole(roleId);
    }
}

